<!--使用 extends 继承base.html -->
{% extends "learning_logs/base.html" %}

{% block page_header %}
  <h1>Topics</h1>
{% endblock page_header %}

<!-- 开始定义块content的内容-->
{% block content %}

<ul>
    {% for topic in topics %}
      <li><h3>
        <a href="{% url 'learning_logs:topic' topic.id %}">{{ topic }}</a>
      </h3></li>  <!--属性topic.id链接到特定主题下的相应内容页面-->
    {% empty %}  <!-- 列表topics为空时的处理-->
      <li><h3>
        No topics have been added yet.
      </h3></li>
    {% endfor %}  <!--for循环结束位置 -->
</ul>

<h3>
  <a href="{% url 'learning_logs:new_topic' %}">Add a new topic</a>
</h3>

{% endblock content %}